/* 全局样式 */
body {
    font-family: 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    color: #333;
    min-height: 100vh;
    background: linear-gradient(to bottom, #0d6efd 0%, #0d6efd 200px, #f8f9fa 800px);
    background-attachment: fixed;
    margin: 0;
    padding: 0;
}

/* 图片懒加载样式 */
.lazy-img {
    opacity: 0;
    transition: opacity 0.3s ease-in;
}

.lazy-img.loaded {
    opacity: 1;
}

/* 导航栏样式 */
.navbar {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar-brand {
    font-weight: bold;
}

/* 轮播图样式 */
.carousel {
    height: 400px;
    margin-bottom: 4rem;
}

.carousel-item {
    height: 100%;
}

.carousel-item img {
    object-fit: cover;
    height: 100%;
}

.carousel-caption {
    bottom: 150px;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

/* 新闻类别卡片样式 */
.category-card {
    background: linear-gradient(135deg, #2196F3, #64B5F6);
    border-radius: 15px;
    overflow: hidden;
    transition: transform 0.3s ease;
    width: 220px;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.category-card-content {
    padding: 1.5rem;
}

.category-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.category-title {
    color: white;
    margin-bottom: 0.8rem;
    font-size: 1.2rem;
}

.category-text {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.category-link {
    padding: 0.5rem 1.5rem;
    font-size: 0.9rem;
}

.history-list {
    max-height: 400px;
    overflow-y: auto;
}

.history-list::-webkit-scrollbar {
    width: 8px;
}

.history-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.history-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 功能卡片样式 */
.card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin-bottom: 20px;
    border: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.card-img-top {
    height: 200px;
    object-fit: cover;
    width: 100%;
}

.card-body {
    padding: 1.5rem;
}

.card-title {
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #2c3e50;
}

.card-text {
    color: #6c757d;
    margin-bottom: 1.25rem;
    line-height: 1.6;
}

/* 容器样式 */
.container {
    padding: 2rem 1rem;
}

@media (min-width: 768px) {
    .container {
        padding: 2rem 2rem;
    }
}

/* 表单样式 */
.form-control:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* 按钮样式 */
.btn-primary {
    padding: 0.5rem 1.5rem;
    font-weight: bold;
}

/* 底部样式 */
footer {
    margin-top: 4rem;
}

footer a {
    text-decoration: none;
    transition: color 0.3s ease;
}

footer a:hover {
    color: #0d6efd !important;
}

/* 在线客服样式 */
.chatbot-container {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 350px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    z-index: 1000;
    max-height: 70vh;
}

.chatbot-container.show {
    display: flex;
}

.chatbot-header {
    background: #0d6efd;
    color: white;
    padding: 15px;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-header h6 {
    margin: 0;
    font-weight: 600;
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fa;
}

.message {
    margin-bottom: 15px;
    max-width: 80%;
    clear: both;
}

.user-message {
    float: right;
    margin-left: auto;
}

.bot-message {
    float: left;
    margin-right: auto;
}

.message-content {
    padding: 10px 15px;
    border-radius: 18px;
    display: inline-block;
}

.user-message .message-content {
    background: #0d6efd;
    color: white;
    border-top-right-radius: 5px;
}

.bot-message .message-content {
    background: #e9ecef;
    color: #212529;
    border-top-left-radius: 5px;
}

/* 正在输入动画 */
.typing-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #6c757d;
    margin: 0 2px;
    opacity: 0.4;
}

.typing-dot:nth-child(1) {
    animation: typing 1s infinite;
}

.typing-dot:nth-child(2) {
    animation: typing 1s infinite 0.2s;
}

.typing-dot:nth-child(3) {
    animation: typing 1s infinite 0.4s;
}

@keyframes typing {
    0%, 100% {
        opacity: 0.4;
        transform: translateY(0);
    }
    50% {
        opacity: 1;
        transform: translateY(-5px);
    }
}

/* ====================================
   AI 新闻助手样式
   ==================================== */

/* AI 助手整体样式 */
#ai-assistant {
    background-color: #f8f9fa;
    padding: 2rem 0;
}

/* 消息气泡 */
.user-message .bg-primary {
    border-top-right-radius: 0 !important;
}

.assistant-message .bg-light {
    border-top-left-radius: 0 !important;
    background-color: #f1f3f5 !important;
}

/* 预设问题按钮 */
.preset-questions {
    padding: 0 1rem;
}

.preset-question {
    font-size: 0.8rem;
    white-space: nowrap;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
}

.preset-question:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* 聊天消息区域 */
#chat-messages {
    scrollbar-width: thin;
    scrollbar-color: #ccc #f1f1f1;
    padding: 15px;
    background-color: #fff;
    border-radius: 0 0 0.375rem 0.375rem;
}

#chat-messages::-webkit-scrollbar {
    width: 6px;
}

#chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

#chat-messages::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* 输入框 */
#user-input {
    resize: none;
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    padding: 0.75rem 1rem;
    line-height: 1.5;
}

#user-input:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* 发送按钮 */
#chat-form button[type="submit"] {
    min-width: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 打字光标 */
.typing-cursor {
    display: inline-block;
    width: 6px;
    height: 1em;
    background: #0d6efd;
    margin-left: 2px;
    animation: blink 1s step-end infinite;
    vertical-align: middle;
}

@keyframes blink {
    from, to { opacity: 1; }
    50% { opacity: 0; }
}

/* 消息时间戳 */
.message-time {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 0.25rem;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .message-bubble {
        max-width: 90% !important;
    }
    
    .assistant-avatar, .user-avatar {
        width: 30px !important;
        height: 30px !important;
    }
    
    .preset-question {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }
    
    #ai-assistant {
        padding: 1rem 0;
    }
}

/* 清除浮动 */
.clearfix::after {
    content: "";
    display: table;
    clear: both;
}

/* 旧版聊天机器人样式，保留兼容性 */
.chatbot-input {
    display: flex;
    padding: 15px;
    border-top: 1px solid #dee2e6;
    background: white;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
}

.chatbot-input input {
    flex: 1;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    padding: 8px 15px;
    margin-right: 10px;
}

#chatbotToggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .carousel-caption {
        bottom: 100px;
    }
    
    .chatbot-container {
        width: 90%;
        right: 5%;
        bottom: 70px;
    }
    
    .carousel-caption h2 {
        font-size: 2rem;
    }
    
    .carousel-caption p {
        font-size: 1.2rem;
    }
}
